home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Portable Patmos / usr / include / netccitt / pk_var.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-08  |  7.1 KB  |  180 lines  |  [TEXT/R*ch]

  1. /*
  2.  * Copyright (c) University of British Columbia, 1984
  3.  * Copyright (c) 1990 The Regents of the University of California.
  4.  * All rights reserved.
  5.  *
  6.  * This code is derived from software contributed to Berkeley by
  7.  * the Laboratory for Computation Vision and the Computer Science Department
  8.  * of the University of British Columbia.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *    This product includes software developed by the University of
  21.  *    California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  *
  38.  *    from: @(#)pk_var.h    7.11 (Berkeley) 5/29/91
  39.  *    $Id: pk_var.h,v 1.3 1993/05/20 04:12:25 cgd Exp $
  40.  */
  41.  
  42. #ifndef _NETCCITT_PK_VAR_H_
  43. #define _NETCCITT_PK_VAR_H_
  44.  
  45. /*
  46.  *
  47.  *  X.25 Logical Channel Descriptor
  48.  *
  49.  */
  50.  
  51. struct pklcd {
  52.     struct     pklcd_q {
  53.         struct    pklcd_q *q_forw;    /* debugging chain */
  54.         struct    pklcd_q *q_back;    /* debugging chain */
  55.     } lcd_q;
  56.     int    (*lcd_upper)();        /* switch to socket vs datagram vs ...*/
  57.     caddr_t    lcd_upnext;        /* reference for lcd_upper() */
  58.     int    (*lcd_send)();        /* if X.25 front end, direct connect */
  59.     caddr_t lcd_downnext;        /* reference for lcd_send() */
  60.     short   lcd_lcn;        /* Logical channel number */
  61.     short   lcd_state;        /* Logical Channel state */
  62.     short   lcd_timer;        /* Various timer values */
  63.     short   lcd_dg_timer;        /* to reclaim idle datagram circuits */
  64.         bool    lcd_intrconf_pending;    /* Interrupt confirmation pending */
  65.     octet    lcd_intrdata;        /* Octet of incoming intr data */
  66.     char    lcd_retry;        /* Timer retry count */
  67.     char    lcd_rsn;        /* Seq no of last received packet */
  68.     char    lcd_ssn;        /* Seq no of next packet to send */
  69.     char    lcd_output_window;    /* Output flow control window */
  70.     char    lcd_input_window;    /* Input flow control window */
  71.     char    lcd_last_transmitted_pr;/* Last Pr value transmitted */
  72.         bool    lcd_rnr_condition;    /* Remote in busy condition */
  73.         bool    lcd_window_condition;    /* Output window size exceeded */
  74.         bool    lcd_reset_condition;    /* True, if waiting reset confirm */
  75.     bool    lcd_rxrnr_condition;    /* True, if we have sent rnr */
  76.     char    lcd_packetsize;        /* Maximum packet size */
  77.     char    lcd_windowsize;        /* Window size - both directions */
  78.         octet    lcd_closed_user_group;    /* Closed user group specification */
  79.     char    lcd_flags;        /* copy of sockaddr_x25 op_flags */
  80.     struct    mbuf *lcd_facilities;    /* user supplied facilities for cr */
  81.     struct    mbuf *lcd_template;    /* Address of response packet */
  82.     struct    socket *lcd_so;        /* Socket addr for connection */
  83.     struct    sockaddr_x25 *lcd_craddr;/* Calling address pointer */
  84.     struct    sockaddr_x25 *lcd_ceaddr;/* Called address pointer */
  85.     time_t    lcd_stime;        /* time circuit established */
  86.     long    lcd_txcnt;        /* Data packet transmit count */
  87.     long    lcd_rxcnt;        /* Data packet receive count */
  88.     short   lcd_intrcnt;        /* Interrupt packet transmit count */
  89.     struct    pklcd *lcd_listen;    /* Next lcd on listen queue */
  90.     struct    pkcb *lcd_pkp;        /* Network this lcd is attached to */
  91.     struct    mbuf *lcd_cps;        /* Complete Packet Sequence reassembly*/
  92.     long    lcd_cpsmax;        /* Max length for CPS */
  93.     struct    sockaddr_x25 lcd_faddr;    /* Remote Address (Calling) */
  94.     struct    sockaddr_x25 lcd_laddr;    /* Local Address (Called) */
  95.     struct    sockbuf lcd_sb;        /* alternate for datagram service */
  96. };
  97.  
  98. /*
  99.  * Per network information, allocated dynamically
  100.  * when a new network is configured.
  101.  */
  102.  
  103. struct    pkcb {
  104.     struct    pkcb *pk_next;
  105.     short    pk_state;        /* packet level status */
  106.     short    pk_maxlcn;        /* local copy of xc_maxlcn */
  107.     int    (*pk_lloutput) ();    /* link level output procedure */
  108.     caddr_t pk_llnext;        /* handle for next level down */
  109.     struct    x25config *pk_xcp;    /* network specific configuration */
  110.     struct    x25_ifaddr *pk_ia;    /* backpointer to ifaddr */
  111.     struct    pklcd **pk_chan;    /* actual size == xc_maxlcn+1 */
  112. };
  113. /*
  114.  *    Interface address, x25 version. Exactly one of these structures is 
  115.  *    allocated for each interface with an x25 address.
  116.  *
  117.  *    The ifaddr structure conatins the protocol-independent part
  118.  *    of the structure, and is assumed to be first.
  119.  */
  120. struct x25_ifaddr {
  121.     struct    ifaddr ia_ifa;        /* protocol-independent info */
  122. #define ia_ifp    ia_ifa.ifa_ifp
  123. #define    ia_flags ia_ifa.ifa_flags
  124.     struct    x25config ia_xc;    /* network specific configuration */
  125. #define ia_maxlcn ia_xc.xc_maxlcn
  126.     int    (*ia_start) ();        /* connect, confirm method */
  127.     struct    sockaddr_x25 ia_dstaddr; /* reserve space for route dst */
  128. };
  129.  
  130. /*
  131.  * ``Link-Level'' extension to Routing Entry for upper level
  132.  * packet switching via X.25 virtual circuits.
  133.  */
  134. struct llinfo_x25 {
  135.     struct    llinfo_x25 *lx_next;    /* chain together in linked list */
  136.     struct    llinfo_x25 *lx_prev;    /* chain together in linked list */
  137.     struct    rtentry *lx_rt;        /* back pointer to route */
  138.     struct    pklcd *lx_lcd;        /* local connection block */
  139.     struct    x25_ifaddr *lx_ia;    /* may not be same as rt_ifa */
  140.     int    lx_state;        /* can't trust lcd->lcd_state */
  141.     int    lx_flags;
  142.     int    lx_timer;        /* for idle timeout */
  143.     int    lx_family;        /* for dispatch */
  144. };
  145.  
  146. /* States for lx_state */
  147. #define LXS_NEWBORN        0
  148. #define LXS_RESOLVING        1
  149. #define LXS_FREE        2
  150. #define LXS_CONNECTING        3
  151. #define LXS_CONNECTED        4
  152. #define LXS_DISCONNECTING     5
  153. #define LXS_LISTENING         6
  154.  
  155. /* flags */
  156. #define LXF_VALID    0x1        /* Circuit is live, etc. */
  157. #define LXF_RTHELD    0x2        /* this lcb references rtentry */
  158. #define LXF_LISTEN    0x4        /* accepting incoming calls */
  159.  
  160. /*
  161.  * miscellenous debugging info
  162.  */
  163. struct mbuf_cache {
  164.     int    mbc_size;
  165.     int    mbc_num;
  166.     int    mbc_oldsize;
  167.     struct    mbuf **mbc_cache;
  168. };
  169.  
  170. #if defined(KERNEL) && defined(CCITT)
  171. struct    pkcb *pkcbhead;        /* head of linked list of networks */
  172. struct    pklcd *pk_listenhead;
  173. struct    pklcd *pk_attach();
  174.  
  175. extern char    *pk_name[], *pk_state[];
  176. int    pk_t20, pk_t21, pk_t22, pk_t23;
  177. #endif
  178.  
  179. #endif /* !_NETCCITT_PK_VAR_H_ */
  180.